<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en-gb"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en-gb"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en-gb"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="ru-RU"> <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title><?php echo CHtml::encode($this->pageTitle) . ' | '.Yii::app()->name; ?></title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
  <!-- You can also compile style.less to use regular css. Your apps will still work. -->

  <link rel="stylesheet" type="text/css" href="<?php echo $this->getBaseUrl(); ?>/css/kickstrap.css">
  <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<!-- Sticky Footer Wrapper -->
<?php
    $selected_region_name = (0 < Yii::app()->session['region_id']) ? GxHtml::encode($this->getRegionAttr(Yii::app()->session['region_id'], 'name')) : Yii::t('app', 'Все регионы');
    $selected_city_name = (0 < Yii::app()->session['city_id']) ? GxHtml::encode($this->getCityAttr(Yii::app()->session['city_id'], 'name')) : Yii::t('app', 'Все города');
?>

<div id="sf-wrapper">
	<header class="navbar navbar-fixed-top">
		<div class="navbar-inner navbar-top">
			<div class="container">
				<!--[if lt IE 8]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
				<div class="row-fluid">
					<section class="user-3cols">
						<a href="/" id="logo"><img src="<?php echo $this->getBaseUrl(); ?>/images/logo.png" width="237" height="76" alt="" /></a>
					</section>
					<section class="user-3cols-center">
						<div class="region">
							<a href="#myModal" data-toggle="modal"><?php echo $selected_region_name;?></a>
                            &nbsp;&nbsp;&gt;&nbsp;&nbsp;
                            <!--<a href="#myModal" data-toggle="modal">--><?php echo $selected_city_name ?><!--</a>-->
						</div>
							<?php						
							$form=$this->beginWidget('CActiveForm', array(
								'action'=>Yii::app()->createUrl('search/index'),
								'method'=>'get',
								'htmlOptions' => array('class'=>'form-search'),
							));						
							?>
							<div class="input-append">
							<?php //echo $form->textField($model, 'title', array('maxlength' => 150,'placeholder'=>UserModule::t('Заголовок'))); ?>
								<input type="text" class="search-query" name="sq" value="<?php echo isset($_REQUEST['sq']) ? GxHtml::encode($_REQUEST['sq']) : '';?>" placeholder="<?php echo Yii::t('app', 'Поиск');?>">
								<?php echo GxHtml::htmlButton('<i class="icon-search"></i>', array('class'=>'btn', 'type' => 'submit')); ?>
							</div>
							<?php $this->endWidget(); ?>						
						
					</section>
					<section class="user-3cols">
						<div class="user-menu">
                            <?php if (Yii::app()->user->isGuest) :?>
							
                                <a href="<?php echo Yii::app()->createUrl('/home/login'); ?>" ><?php echo Yii::t('app', 'Вход');?></a>
                            <?php else : ?>
								<span><?php echo Yii::t('app', 'Приветствуем ');?>, <?php echo Yii::app()->user->first_name .' '.Yii::app()->user->last_name; ?></span>&nbsp;&nbsp;
                                <a href="<?php echo Yii::app()->createUrl('/user/profile'); ?>" ><?php echo Yii::t('app', 'Мой аккаунт');?></a>
								<?php if (Controller::checkAdmin()): ?>
									<a href="<?php echo Yii::app()->createUrl('/admin/default'); ?>" ><?php echo Yii::t('app', 'Управление');?></a>
								<?php endif; ?>	
                                <a href="<?php echo Yii::app()->createUrl('/home/logout'); ?>" ><?php echo Yii::t('app', 'Выход');?></a>
                            <?php endif; ?>
						</div>
						<div class="add-firm">
                            <?php if (Yii::app()->user->isGuest) :?>
                                <a href="<?php echo Yii::app()->createUrl('/user/registration'); ?>" class="btn btn-large btn-warning">
                                    <?php echo Yii::t('app', 'Новая фирма');?>
                                </a>
                            <?php else : ?>
								<?php if (1 != intval(Yii::app()->user->approved)) :?>
								<p>
									<?php echo Yii::t('app', 'Ваш аккаунт еще не активирован');?>
									<br/>
									<?php echo Yii::t('app', 'Необходимо закончить процесс активации. Проверьте ваш email');?>
									<br/>
									<a href="<?php echo Yii::app()->createUrl('/user/profile'); ?>" >
										<?php echo Yii::t('app', 'Детали');?>
									</a>
								</p>
								<?php else : ?>							
                                <a href="<?php echo Yii::app()->createUrl('/user/myfirms'); ?>" class="btn btn-large btn-warning">
                                    <?php echo Yii::t('app', 'Мои фирмы');?>
                                </a>
								<?php endif; ?>
                            <?php endif; ?>
						</div>
					</section>
				</div>
			</div>
		</div>
		<div class="navbar-inner navbar-bottom">
			<div class="container">
				<div class="row-fluid">
					<section class="user-3cols">
						<div class="navbar-bottom-col navbar-col-left">
							<?php echo Yii::t('app', 'Предприятий всего');?><br />
							<strong>100500</strong>
						</div>
					</section>
					<section class="user-3cols-center">
						<div class="navbar-bottom-col navbar-col-center">
							<ul class="nav">
								<li class="">
									<a href="<?php echo Yii::app()->createUrl('/rubrics', array('st_id' => 0)); ?>"><?php echo Controller::getServiceType(0);?></a>
									<div class="container nav-dropdown">
										<div class="row-fluid">
                                            <?php foreach(Yii::app()->basestatic->rubrics(0) as $rubric):?>
											<div class="span3">
												<h2><a href="<?php echo Yii::app()->createUrl('/rubrics/single', array('st_id' => 0, 'rid' => $rubric['id'])); ?>">
                                                    <?php echo GxHtml::encode($rubric['name']);?>
                                                    </a>
                                                </h2>
                                                <?php if (0 < count($rubric['categories'])):?>
                                                    <ul class="unstyled">
                                                        <?php foreach($rubric['categories'] as $category):?>
                                                            <li><a href="<?php echo Yii::app()->createUrl('/category', array('st_id' => 0,'rid'=>$rubric['id'], 'cid'=>$category['id']/*, 'slug'=> $rubric->slug*/));?>">
                                                                <?php echo GxHtml::encode($category['name']); ?></a>
                                                            </li>
                                                        <?php endforeach;?>
                                                    </ul>
                                                <?php endif;?>
											</div>
                                            <?php endforeach;?>
										</div>
									</div>
								</li>
								<li class="nav-last">
									<a href="<?php echo Yii::app()->createUrl('/rubrics', array('st_id' => 1)); ?>"><?php echo Controller::getServiceType(1);?></a>
									<div class="container nav-dropdown">
										<div class="row-fluid">
                                            <?php foreach(Yii::app()->basestatic->rubrics(1) as $rubric):?>
											<div class="span3">
												<h2><a href="<?php echo Yii::app()->createUrl('/rubrics/single', array('st_id' => 1, 'rid' => $rubric['id'])); ?>">
                                                    <?php echo GxHtml::encode($rubric['name']);?>
                                                    </a>
                                                </h2>
                                                <?php if (0 < count($rubric['categories'])):?>
                                                    <ul class="unstyled">
                                                        <?php foreach($rubric['categories'] as $category):?>
                                                            <li><a href="<?php echo Yii::app()->createUrl('/category', array('st_id' => 1,'rid'=>$rubric['id'], 'cid'=>$category['id']/*, 'slug'=> $rubric->slug*/));?>">
                                                                <?php echo GxHtml::encode($category['name']); ?></a>
                                                            </li>
                                                        <?php endforeach;?>
                                                    </ul>
                                                <?php endif;?>
											</div>
                                            <?php endforeach;?>
										</div>
									</div>
								</li>
							</ul>
						</div>
					</section>
					<section class="user-3cols">
						<div class="navbar-bottom-col navbar-col-right">
							<?php echo Yii::t('app', 'Просмотров за текущий месяц');?><br />
							<strong>100500</strong>
						</div>
					</section>
				</div>
			</div>
		</div>
	</header>

	
	<section class="container main-outer">
		<?php if(isset($this->breadcrumbs)):?>
			<?php $this->widget('zii.widgets.CBreadcrumbs', array('links'=>$this->breadcrumbs,)); ?>
		<?php endif?>	
        <?php echo $content; ?>
	</section>
	<div id="push"></div>
</div>
<!-- sf-wrapper -->
<footer id="footer">
	<div class="container">
		<div class="nav">
            <a href="<?php echo Yii::app()->createUrl('/pages/about'); ?>" ><?php echo Yii::t('app', 'О нас');?></a>
            <a href="<?php echo Yii::app()->createUrl('/pages/contact'); ?>" ><?php echo Yii::t('app', 'Контакты');?></a>
            <a href="<?php echo Yii::app()->createUrl('/pages/privacy'); ?>" ><?php echo Yii::t('app', 'Правила пользования');?></a>
		</div>
		<div class="copyright">Copyright <?php echo date('Y');?></div>
	</div>
</footer>

<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="regionsLabel" aria-hidden="true">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h3 id="regionsLabel">
			<span data-href="/regions/select">Украина</span>
		</h3>
	</div>
	<div class="modal-body">
		<div class="row-fluid">
			<div class="region_cols span4" id="regions_col_0"></div>
			<div class="region_cols span4" id="regions_col_1"></div>
			<div class="region_cols span4" id="regions_col_2"></div>
		</div>
	</div>
	<!--
	<div class="modal-footer">
		<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
		<button class="btn btn-primary">Save changes</button>
	</div>
	-->
</div>
<script>
var regions = <?php echo json_encode($this->regionsData()); ?>;
var regions_url = "<?php echo Yii::app()->createUrl('regions/index'); ?>";
var json_regions_url = "<?php echo Yii::app()->createUrl('regions/regions'); ?>";
var json_cities_url = "<?php echo Yii::app()->createUrl('regions/cities'); ?>";
var flag_show_RegionsPopup = <?php echo ($this->flag_showRegionsPopup) ? 'true' : 'false'; ?>;
</script>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="<?php echo $this->getBaseUrl(); ?>/js/jquery-1.8.3.min.js"><\/script>');</script>
<!-- Kickstrap CDN thanks to our friends at netDNA.com -->
<script id="appList" src="//netdna.getkickstrap.com/1.3/Kickstrap/js/kickstrap.min.js"></script>
<script>window.consoleLog || document.write('<script id="appList" src="<?php echo $this->getBaseUrl(); ?>/js/kickstrap.min.js"><\/script>')</script>

<script src="<?php echo $this->getBaseUrl(); ?>/js/bootstrap-modal.js"></script>
<script src="<?php echo $this->getBaseUrl(); ?>/js/base.js"></script>



</body>
</html>